Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d12 wgl] Upgrade to windows 0.59 crates #6876

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

MarijnS95
Copy link
Contributor

@MarijnS95 MarijnS95 commented Jan 8, 2025

Connections
Depends on Traverse-Research/gpu-allocator#258 and Xudong-Huang/generator-rs#72.

https://github.com/microsoft/windows-rs/releases/tag/0.61.0

Description
The latest windows 0.59 and windows-core 0.59 crates were just released (strangely tagged 0.61), including some minor code improvements for us. The MSRV has been bumped to 1.74, but wgpu is already on 1.76 anyway.

Testing
Not yet, only cross-compiled.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.
  • Replaced crate patches with actual releases.

@MarijnS95 MarijnS95 requested a review from a team as a code owner January 8, 2025 11:06
unsafe { OpenGL::wglMakeCurrent(None, None) }
unsafe { OpenGL::wglMakeCurrent(Default::default(), Default::default()) }
Copy link
Contributor Author

@MarijnS95 MarijnS95 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennykerr can you help us here? I did not do my due diligence this time to search through windows-rs and win32metadata for relevant changes, but while most handles have been made optional (see other Some() wrapping changes in this PR), quite strangely these parameters are no longer optional in wglMakeCurrent() where they have a specific use-case to uncurrent the context.

Is this change intended or accidental? We can clearly get around it by passing a defaulted HDC/HGLRC, but it seems strange when compared to other functions where None can be passed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code generator now faithfully honors the metadata's [Optional] attribute - in the case of wglMakeCurrent the handle parameters are not optional whereas in the case of CreateSwapChainForCompositionSurfaceHandle the handle parameter is optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kennykerr. So this'll take another trip through win32metadata to annotate correctly.

@MarijnS95 MarijnS95 mentioned this pull request Jan 8, 2025
5 tasks
https://github.com/microsoft/windows-rs/releases/tag/0.61.0

The latest `windows 0.59` and `windows-core 0.59` crates were
just released (strangely tagged `0.61`), including some minor code
improvements for us.  The MSRV has been bumped to `1.74`, but `wgpu` is
already on `1.76` anyway.
@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jan 8, 2025

Just to set expectations here, we likely can't merge this for a bit, as firefox is currently on 0.58 and migration will be a bit of a thing. @ErichDonGubler will take charge of this.

I don't expect there to be a ton of problems with this PR just hanging out for a while. I'm going to mark this as draft as we can't merge it, but @Wumpf will review it still.

@cwfitzgerald cwfitzgerald marked this pull request as draft January 8, 2025 19:39
@MarijnS95
Copy link
Contributor Author

MarijnS95 commented Jan 9, 2025

@cwfitzgerald that's all good, I don't expect this to be merged until the upgrade has fully trickled through the ecosystem. Just making sure we have a PR open with all the necessary changes that I couldn't make in the original windows-rs migration due to missing or incorrect upstream annotations.

@ErichDonGubler
Copy link
Member

ErichDonGubler commented Jan 10, 2025

There are a few things that I'm already aware need to happen in mozilla-central before this can land:

@larseggert
Copy link

Regarding neqo and mtu, we can bump whenever you're ready - just let us know. (CC @mxinden for info).

@mxinden
Copy link

mxinden commented Jan 10, 2025

Regarding neqo and mtu, we can bump whenever you're ready - just let us know. (CC @mxinden for info).

Under the assumption that windows v0.59 does not introduce a breaking change for neqo or mtu, we can also make neqo and mtu compatible to both windows v0.58 and v0.59 by configuring a range:

windows-sys = { version = ">=0.58, <=0.59"

See quinn-rs/quinn#2021 as an example from one of our upstream dependencies.

@ErichDonGubler let me know what works best for you.

@ErichDonGubler
Copy link
Member

ErichDonGubler commented Jan 10, 2025

@mxinden: If a range dependency works for neqo and mtu, then wonderful, let's please do that. 😀 Did you want me to file PRs?

ETA: Filed! See the comment (#6876 (comment)) for details.

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw code lgtm and took it on a spin running examples locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

7 participants